import request from "../../utils/request";
import { AxiosPromise } from "axios";
import { LoginData, LoginResult, UserInfoResult } from "./types";

/**
 * 登录API
 *
 * @param data {LoginData}
 * @returns
 */
export function login(data: LoginData): AxiosPromise<LoginResult> {
  return request({
    url: "/login",
    method: "post",
    data: data,
  });
}

export function userInfo(): AxiosPromise<UserInfoResult> {
  return request({
    url: '/userInfo',
    method: 'get'
  })
}

export function getBlindDatesMemberList(): any {
  return request({
    url: '/getBlindDatesMemberList',
    method: "post"
  })
}

// 上传文件
export function uploadFile(data: any): any {
  return request({
    url: '/system/uploadfile',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}


export function imgToCartton(data: any): any {
  return request({
    url: '/system/img/avatartocartton',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}


export default {
  login,
  userInfo,
  getBlindDatesMemberList,
  uploadFile,
  imgToCartton,
}